<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head th:include="/shop/include :: header"></head>
<body class="layui-layout-body">

<div id="LAY_app">
    <div class="layui-layout layui-layout-admin">
        <div class="layui-header">
            <!-- 头部区域 -->
            <ul class="layui-nav layui-layout-left">
                <li class="layui-nav-item layadmin-flexible" lay-unselect>
                    <a href="javascript:;" layadmin-event="flexible" title="侧边伸缩">
                        <i class="layui-icon layui-icon-shrink-right" id="LAY_app_flexible"></i>
                    </a>
                </li>
                <li class="layui-nav-item" lay-unselect>
                    <a href="javascript:;" layadmin-event="refresh" title="刷新">
                        <i class="layui-icon layui-icon-refresh-3"></i>
                    </a>
                </li>
            </ul>
            <ul class="layui-nav layui-layout-right" lay-filter="layadmin-layout-right">
                <li class="layui-nav-item layui-hide-xs" lay-unselect>
                    <a href="javascript:;" layadmin-event="theme">
                        <i class="layui-icon layui-icon-theme"></i>
                    </a>
                </li>
                <li class="layui-nav-item layui-hide-xs" lay-unselect>
                    <a href="javascript:;" layadmin-event="note">
                        <i class="layui-icon layui-icon-note"></i>
                    </a>
                </li>
                <li class="layui-nav-item layui-hide-xs" lay-unselect>
                    <a href="javascript:;" layadmin-event="fullscreen">
                        <i class="layui-icon layui-icon-screen-full"></i>
                    </a>
                </li>
                <li class="layui-nav-item layui-hide-xs" pc="" title="清除缓存">
                    <a href="javascript:;" onclick="clearCache()" class="clearCache">
                        <i class="layui-icon">&#xe640;</i>
                    </a>
                </li>
                <li class="layui-nav-item layui-hide-xs lockcms" pc="" title="锁屏">
                    <a href="javascript:;" onclick="lockPage()"><i class="layui-icon">&#xe673;</i></a>
                </li>
                <li class="layui-nav-item" lay-unselect>
                    <a href="javascript:;">
                        <cite><span id="name"></span></cite>
                    </a>
                    <dl class="layui-nav-child">
                        <dd><a lay-href="/administrators/updatePassword">修改密码</a></dd>
                        <hr>
                        <dd style="text-align: center;" onclick="logout()"><a>退出</a></dd>
                    </dl>
                </li>
            </ul>
        </div>

        <!-- 侧边菜单 -->
        <div class="layui-side layui-side-menu">
            <div class="layui-side-scroll">
                <div class="layui-logo" lay-href="/administrators/AdministratorsList">
                    <span>招聘网</span>
                </div>

                <ul class="layui-nav layui-nav-tree" lay-shrink="all" id="LAY-system-side-menu"
                    lay-filter="layadmin-system-side-menu">
                </ul>
            </div>
        </div>

        <!-- 页面标签 -->
        <div class="layadmin-pagetabs" id="LAY_app_tabs">
            <div class="layui-icon layadmin-tabs-control layui-icon-prev" layadmin-event="leftPage"></div>
            <div class="layui-icon layadmin-tabs-control layui-icon-next" layadmin-event="rightPage"></div>
            <div class="layui-icon layadmin-tabs-control layui-icon-down">
                <ul class="layui-nav layadmin-tabs-select" lay-filter="layadmin-pagetabs-nav">
                    <li class="layui-nav-item" lay-unselect>
                        <a href="javascript:;"></a>
                        <dl class="layui-nav-child layui-anim-fadein">
                            <dd layadmin-event="closeThisTabs"><a href="javascript:;">关闭当前标签页</a></dd>
                            <dd layadmin-event="closeOtherTabs"><a href="javascript:;">关闭其它标签页</a></dd>
                            <dd layadmin-event="closeAllTabs"><a href="javascript:;">关闭全部标签页</a></dd>
                        </dl>
                    </li>
                </ul>
            </div>
            <div class="layui-tab" lay-unauto lay-allowClose="true" lay-filter="layadmin-layout-tabs">
                <ul class="layui-tab-title" id="LAY_app_tabsheader">
                    <li lay-id="/administrators/AdministratorsList" lay-attr="/administrators/AdministratorsList"
                        class="layui-this"><i
                            class="layui-icon layui-icon-home"></i></li>
                </ul>
            </div>
        </div>


        <!-- 主体内容 -->
        <div class="layui-body" id="LAY_app_body">
            <div class="layadmin-tabsbody-item layui-show">
                <iframe src="/platform/page/member_info/list" frameborder="0" class="layadmin-iframe"></iframe>
            </div>
        </div>

        <!-- 辅助元素，一般用于移动设备下遮罩 -->
        <div class="layadmin-body-shade" layadmin-event="shade"></div>
    </div>
</div>

<div th:include="/shop/include::footer"></div>
<script>
    layui.config({
        base: '../../layuiadmin/' //静态资源所在路径
    }).extend({
        index: 'lib/index' //主入口模块
    }).use(['index', 'table', 'form', 'laydate'], function () {
        var admin = layui.admin
            , $ = layui.$
            , table = layui.table
            , element = layui.element
            , layer = layui.layer
            , laydate = layui.laydate
            , form = layui.form;
        $.ajax({
            url: "/platform/menu/selectMenu?id=" + window.sessionStorage.getItem("platform_ID"),
            type: "get",
            async: false,
            success: function (result) {
                if (result.status == "SUCCESS") {
                    var data = result.data;
                    $("#LAY-system-side-menu").html(data)
                    var name = window.sessionStorage.getItem("platform_nickName");
                    $("#name").text(name);
                    element.init();
                } else {
                    layer.msg(result.message)
                }
            }
        });
    })
</script>
<script>
    function logout() {
        $.ajax({
            url: "/platform/page/platformLogOut",    // 提交到controller的url路径
            type: "GET",    // 提交方式
            success: function (result) {
                if (result.status == 'SUCCESS') {
                    location.href = "/platform/page/login"
                }
            }
        })
    }

    function clearCache() {
        window.sessionStorage.clear();
        window.localStorage.clear();
        var index = layer.msg('清除缓存中，请稍候', {icon: 16, time: false, shade: 0.8});
        setTimeout(function () {
            layer.close(index);
            layer.msg("缓存清除成功！");
        }, 1000);
    }

    var is = window.sessionStorage.getItem("lockcms");
    if (is == 'true') {
        layer.open({
            title: false,
            type: 1,
            content: '<div class="admin-header-lock" id="lock-box">' +
                '<div class="input_btn" style="width: 360px;height: 120px">' +
                '<div class="admin-header-lock-name" id="lockUserName" style="margin-left: 135px; font-size: large;}">' + name + '</div>' +
                '<input type="password" class="admin-header-lock-input layui-input" autocomplete="off" placeholder="请输入密码解锁.." name="lockPwd" id="lockPwd" style=" width: 200px; display: inline-block; margin-left: 42px; margin-top: 10px;" >' +
                '<button class="layui-btn" id="unlock" onclick="unlock()" style=" margin-left: 10px;">解锁</button>' +
                '<p style="color: red;margin-left: 42px; margin-top: 5px;">请输入登录密码，否则不会解锁成功哦！！！</p>' +
                '</div>' +
                '</div>',
            closeBtn: 0,
            shade: 0.9,
            success: function () {
                //判断是否设置过头像，如果设置过则修改顶部、左侧和个人资料中的头像，否则使用默认头像
                if (window.sessionStorage.getItem('userFace') && $(".userAvatar").length > 0) {
                    $(".userAvatar").attr("src", $(".userAvatar").attr("src").split("images/")[0] + "images/" + window.sessionStorage.getItem('userFace').split("images/")[1]);
                }
            }
        })
        $(".admin-header-lock-input").focus();
    }


    //锁屏
    function lockPage() {
        var name = $("#name").val();
        window.sessionStorage.setItem("lockcms", true);
        layer.open({
            title: false,
            type: 1,
            content: '<div class="admin-header-lock" id="lock-box">' +
                '<div class="input_btn" style="width: 360px;height: 120px">' +
                '<div class="admin-header-lock-name" id="lockUserName" style="margin-left: 135px; font-size: large;}">' + name + '</div>' +
                '<input type="password" class="admin-header-lock-input layui-input" autocomplete="off" placeholder="请输入密码解锁.." name="lockPwd" id="lockPwd" style=" width: 200px; display: inline-block; margin-left: 42px; margin-top: 10px;" >' +
                '<button class="layui-btn" id="unlock" onclick="unlock()" style=" margin-left: 10px;">解锁</button>' +
                '<p style="color: red;margin-left: 42px; margin-top: 5px;">请输入登录密码，否则不会解锁成功哦！！！</p>' +
                '</div>' +
                '</div>',
            closeBtn: 0,
            shade: 0.9,
            success: function () {
                //判断是否设置过头像，如果设置过则修改顶部、左侧和个人资料中的头像，否则使用默认头像
                if (window.sessionStorage.getItem('userFace') && $(".userAvatar").length > 0) {
                    $(".userAvatar").attr("src", $(".userAvatar").attr("src").split("images/")[0] + "images/" + window.sessionStorage.getItem('userFace').split("images/")[1]);
                }
            }
        })
        $(".admin-header-lock-input").focus();
    }


    function unlock() {
        var pwd = $("#lockPwd").val();
        var id = window.sessionStorage.getItem("platform_ID")
        if (pwd == '') {
            layer.msg("请输入解锁密码！");
            $("#lockPwd").focus();
        } else {
            $.ajax({
                url: "/platform/platformaccount/unLock?password=" + pwd + "&id=" + id,    // 提交到controller的url路径
                type: "GET",    // 提交方式
                success: function (result) {    // 请求成功后的回调函数，其中的参数data为controller返回的map,也就是说,@ResponseBody将返回的map转化为JSON格式的数据，然后通过data这个参数取JSON数据中的值
                    if (result.status == 'SUCCESS') {
                        window.sessionStorage.setItem("lockcms", false);
                        $("#lockPwd").val('');
                        layer.closeAll("page");
                    } else {
                        layer.msg("密码错误，请重新输入！");
                        $("#lockPwd").val('').focus();
                    }
                }
            })
        }
    }
</script>
<!-- 百度统计 -->
<script>
    var _hmt = _hmt || [];
    (function () {
        var hm = document.createElement("script");
        hm.src = "https://hm.baidu.com/hm.js?d214947968792b839fd669a4decaaffc";
        var s = document.getElementsByTagName("script")[0];
        s.parentNode.insertBefore(hm, s);
    })();
</script>
</body>
</html>


